package com.three.storemanage.service.impl;

import com.three.core.entity.FrontUser;
import com.three.core.entity.Store;
import com.three.core.vo.R;
import com.three.storemanage.mapper.FrontUserMapper;
import com.three.storemanage.mapper.StoreMapper;
import com.three.storemanage.service.FrontUserService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @FileName: FrontUserServiceImpl
 * @Description:
 * @Author: GYX
 * @CreateTime: 2025/3/17 16:03
 * @Version: 1.0.0
 */
@Service
public class FrontUserServiceImpl implements FrontUserService {
    @Autowired
    private StoreMapper storeMapper;

    @Autowired
    private FrontUserMapper frontUserMapper;

    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired
    private HttpServletRequest request;

    @Override
    public R<Store> selectStoreByCondition(Integer storeId, Integer userId) {
        Store store = storeMapper.selectStoreByCondition(storeId,userId);
        if (store != null){
            return new R<>(200,"查询成功",store);
        }
        return new R<>(500,"查询失败",null);
    }

    @Override
    public R<Integer> insertUser(FrontUser frontUser) {
        int insert = frontUserMapper.insert(frontUser);
        if (insert > 0){
            return new R<>(200,"注册成功",insert);
        }
        return new R<>(500,"注册失败",null);
    }
}
